bitkeeper revision 1.1389.1.25 (42763030SYN-c5A47iaiRMSIUFsKbA)
authorkmacy@netapp.com[kaf24] <kmacy@netapp.com[kaf24]>
Mon, 2 May 2005 13:50:40 +0000 (13:50 +0000)
committerkmacy@netapp.com[kaf24] <kmacy@netapp.com[kaf24]>
Mon, 2 May 2005 13:50:40 +0000 (13:50 +0000)
[PATCH] [PATCH] fix booting with SMP enabled

Let me know if pine has messed up the patch the way gmail does.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/04/30 16:07:55-07:00 kmacy@curly.lab.netapp.com
#   Make FreeBSD work with SMP enabled again
#   Kip Macy <kmacy@fsmware.com>
#
# BitKeeper/etc/logging_ok
#   2005/04/30 16:07:54-07:00 kmacy@curly.lab.netapp.com +1 -0
#   Logging to logging@openlogging.org accepted
#
# freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
#   2005/04/30 16:07:39-07:00 kmacy@curly.lab.netapp.com +22 -12
#   Do shadow directory initialization before SMP page table setup
#
# freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c
#   2005/04/30 16:07:39-07:00 kmacy@curly.lab.netapp.com +2 -1
#   Don't try to probe apics
#

freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c
freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c

index 8fb7f9f12efedfe5207f1985cb97f4fe6c9582fd..7b8fa1b2e58182e4219fae783e104b6b5317ba5d 100644 (file)
@@ -545,7 +545,6 @@ apic_register_enumerator(struct apic_enumerator *enumerator)
 static void
 apic_init(void *dummy __unused)
 {
-       struct apic_enumerator *enumerator;
        uint64_t apic_base;
        int retval, best;
 
@@ -560,6 +559,7 @@ apic_init(void *dummy __unused)
        /* First, probe all the enumerators to find the best match. */
        best_enum = NULL;
        best = 0;
+#ifndef XEN
        SLIST_FOREACH(enumerator, &enumerators, apic_next) {
                retval = enumerator->apic_probe();
                if (retval > 0)
@@ -569,6 +569,7 @@ apic_init(void *dummy __unused)
                        best = retval;
                }
        }
+#endif
        if (best_enum == NULL) {
                if (bootverbose)
                        printf("APIC: Could not find any APICs.\n");
index b61d9ceeb4ee3a376be4e833c772d53829e6bee5..ba1adb1de94337933a87c393456c14e0eba0de46 100644 (file)
@@ -1386,6 +1386,7 @@ initvalues(start_info_t *startinfo)
 { 
     int i;
     vm_paddr_t pdir_shadow_ma, KPTphys;
+    vm_offset_t *pdir_shadow;
 #ifdef WRITABLE_PAGETABLES
     printk("using writable pagetables\n");
     HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
@@ -1424,6 +1425,27 @@ initvalues(start_info_t *startinfo)
     /* allocate page for ldt */
     ldt = (union descriptor *)(KERNBASE + (tmpindex << PAGE_SHIFT));
     tmpindex++; 
+
+    /* initialize page directory shadow page */
+    pdir_shadow = (vm_offset_t *)(KERNBASE + (tmpindex << PAGE_SHIFT));
+    i686_pagezero(pdir_shadow);
+    pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT);
+    PT_SET_MA(pdir_shadow, pdir_shadow_ma | PG_V | PG_A);
+    tmpindex++;
+
+    /* setup shadow mapping first so vtomach will work */
+    xen_pt_pin((vm_paddr_t)pdir_shadow_ma);
+    xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), 
+                       pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M);
+    xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), 
+                       ((vm_paddr_t)IdlePTD) | PG_V | PG_A);
+    xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), 
+                       KPTphys | PG_V | PG_A);
+
+    xen_flush_queue();
+    /* allocate remainder of NKPT pages */
+
+
 #ifdef SMP
     /* allocate cpu0 private page */
     cpu0prvpage = (KERNBASE + (tmpindex << PAGE_SHIFT));
@@ -1458,18 +1480,6 @@ initvalues(start_info_t *startinfo)
        xen_queue_pt_update(KPTphys + i*sizeof(vm_paddr_t), 0);
     xen_flush_queue();
     
-    pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT);
-    tmpindex++;
-
-    /* setup shadow mapping first so vtomach will work */
-    xen_pt_pin((vm_paddr_t)pdir_shadow_ma);
-    xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), 
-                       pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M);
-    xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), 
-                       ((vm_paddr_t)IdlePTD) | PG_V | PG_A);
-    xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), 
-                       KPTphys | PG_V | PG_A);
-
     /* allocate remainder of NKPT pages */
     for (i = 0; i < NKPT-1; i++, tmpindex++) {
        xen_queue_pt_update((vm_paddr_t)(IdlePTD + KPTDI + i + 1),